<?php
require 'configs/config.php';

print_r($_POST);
if(strlen($_GET['q'])){
  $search = "AND p.patientName = '{$_GET['q']}' OR p.patientLastName LIKE'%{$_GET['q']}%'";
  $smarty->assign("q",$_GET['q']);
}
if ($_POST['add']){
	$sql = "insert into `opd`.`patientmaster` (patientFName, patientMName, patientLName, 
			patientGender, email, landline, mobile, address, address1, city, 	PIN, DOB)
		values 	
		('".$_POST['patientFName']."', '".$_POST['patientMName']."','". $_POST['patientLName']."', '".$_POST['patientGender']."', '".$_POST['email']."',
		'".$_POST['landline']."', '".$_POST['mobile']."', '".$_POST['address']."', '".$_POST['address1']."', '".$_POST['city']."','".$_POST['PIN']."' 
		,'".$_POST['birthdate']."')";	
		
		$db->query($sql);
		echo $sql;
}
$smarty->assign("patient",loadPatientDetails($_GET['q']));

$smarty->display('patients.manage.tpl');

?>
  